<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<script type="text/javascript">
<!--
	function confirmDel()
	{
		if(confirm("确认要删除该会议么？"))
		{
			return true;
		}
		return false;
	}
//-->
</script>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
			
	List meetingListtt = (List)request.getAttribute("meetingList");
	if (meetingListtt != null)
		System.out.println("getttttttttttttttttttted:"+meetingListtt.toString());
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
	<html:base />

	<title>会议管理系统</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" type="text/css" href="../css/home.css">
	<script type="text/javascript" src="../js/getRowValue.js"></script>
	<script type="text/javascript" src="../js/selectableelements.js"></script>
	<script type="text/javascript" src="../js/selectabletablerows.js"></script>
	<script type="text/javascript" src="../js/selectabletablecells.js"></script>
	<script type="text/javascript" src="../js/selectablelistitems.js"></script>
	
</head>

<body>
	<h2 align=center>
		会议管理
	</h2>
	<html:form action="/meeting/meetingMg.do" method="POST">
		<label>
			会议名称
		</label>
		<input type="text" name="name" size="50">
		<br>
		<label>
			英文名称
		</label>
		<input type="text" name="name_en" size="50">
		<br>
		<br>
		<label>
			开始日期
		</label>
		<input type="text" name="start_date">
		<label>
			结束日期
		</label>
		<input type="text" name="end_date">
		<br>
		<label>
			会议类型
		</label>
		<input type="text" name="type">

		<label>
			所在地区
		</label>
		<input type="text" name="district">
		<br>
		<label>
			所属行业
		</label>
		<input type="text" name="industry" size="50">
		<br>
		<label>
			主办单位
		</label>
		<input type="text" name="organizer" size="50">
		<br>
		<br>

		<label>
			承办单位
		</label>
		<input type="text" name="sponsor" size="50">
		<br>
		<label>
			协办单位
		</label>
		<input type="text" name="co_organizer" size="50">
		<br>
		<br>
		<label>
			关注度
		</label>
		<input type="text" name="popular">
		<label>
			会议级别
		</label>
		<input type="text" name="level">
		<br>

		<label>
			会议价值
		</label>
		<input type="text" name="value">
		<br>
		<html:reset value="重置"></html:reset>
		<html:submit value="查询" />
		<br>
	</html:form>

	<div>
		<table border="1" cellspacing="0" cellpadding="2"
			style="line-height: 150%" width="800" id="meetingQueryList">

			<tr>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					会议编号
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					会议名称
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					开始日期
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					结束日期
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					会议类型
				</th>

				<th align="center" bgcolor="#F4F4EA" nowrap>
					所在地区
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					行业
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					参会费用
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					关注度
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					级别
				</th>

				<th align="center" bgcolor="#F4F4EA" nowrap>
					价值
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					主办单位
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					承办单位
				</th>
				
				<th align="center" bgcolor="#F4F4EA" nowrap>
					英文名称
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					具体地址
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					摘要
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					协办单位
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					联系人
				</th>
	
				<th align="center" bgcolor="#F4F4EA" nowrap>
					联系电话
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					联系传真
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					邮件地址
				</th>
				<th align="center" bgcolor="#F4F4EA" nowrap>
					网站
				</th>
			</tr>

			<logic:notPresent name="meetingList" scope="request">
				<tr bgcolor="f8f8f8">
					<td align="center" nowrap bgcolor="#F9F9F9" colspan="13">
						没有查询结果可显示
					</td>
				</tr>
			</logic:notPresent>
			<logic:present name="meetingList" scope="request">
				<logic:empty name="meetingList" scope="request">
					<tr bgcolor="f8f8f8">
						<td align="center" nowrap bgcolor="#F9F9F9" colspan="13">
							未找到符合条件的会议信息
						</td>
					</tr>
				</logic:empty>
				<logic:iterate id="meetingList" name="meetingList" scope="request">
					<tr onmouseover="this.style.cursor='pointer';this.style.cursor='hand'"  ondblclick="modifyMeeting()">
						<td align="center" nowrap>
							<bean:write name="meetingList" property="id" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="name" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="start_date" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="end_date" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="type" />
						</td>

						<td align="center" nowrap="true">
							<bean:write name="meetingList" property="district" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="industry" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="charge" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="popular" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="level" />
						</td>

						<td align="center" nowrap="true">
							<bean:write name="meetingList" property="value" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="organizer" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="sponsor" />
						</td>
						
						<!-- following are for updateMeeting.jsp only -->
						<td align="center" nowrap>
							<bean:write name="meetingList" property="name_en" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="location" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="abstract" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="co_organizer" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="contact" />
						</td>
						
						<td align="center" nowrap>
							<bean:write name="meetingList" property="contact_phone" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="contact_fax" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="email" />
						</td>
						<td align="center" nowrap>
							<bean:write name="meetingList" property="website" />
						</td>
					</tr>
				</logic:iterate>
			</logic:present>
		</table>
	</div>
	
	<br />
<table width="800" border="1" cellpadding="3" cellspacing="0">
  <tr>
    <td align="center"><html:button value="添加会议" property="addMeeting" onclick="window.open('./addMeeting.jsp')"></html:button></td>
    <td align="center"><html:button value="删除会议" property="delMeeting" onclick="delMeeting()"></html:button></td>
  </tr>
</table>
<script language="javascript" type="text/javascript">
//定义表格是可选的
var se = new SelectableTableRows(document.getElementById('meetingQueryList'), false);

String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}

function modifyMeeting(){
	var selectItem = se.getSelectedItems();
	var meetingID = getRowValue(selectItem[0],0).Trim();
	var name = getRowValue(selectItem[0],1).Trim();
	var start_date = getRowValue(selectItem[0],2).Trim();
	var end_date = getRowValue(selectItem[0],3).Trim();
	var type = getRowValue(selectItem[0],4).Trim();
	
	var district = getRowValue(selectItem[0],5).Trim();
	var industry = getRowValue(selectItem[0],6).Trim();
	var charge = getRowValue(selectItem[0],7).Trim();
	var popular = getRowValue(selectItem[0],8).Trim();
	var level = getRowValue(selectItem[0],9).Trim();
	
	var value = getRowValue(selectItem[0],10).Trim();
	var organizer = getRowValue(selectItem[0],11).Trim();
	var sponsor = getRowValue(selectItem[0],12).Trim();
	var name_en = getRowValue(selectItem[0],13).Trim();
	var location = getRowValue(selectItem[0],14).Trim();
	
	var abstract = getRowValue(selectItem[0],15).Trim();
	var co_organizer = getRowValue(selectItem[0],16).Trim();
	var contact = getRowValue(selectItem[0],17).Trim();
	var contact_phone = getRowValue(selectItem[0],18).Trim();
	var contact_fax = getRowValue(selectItem[0],19).Trim();
	
	var email = getRowValue(selectItem[0],20).Trim();
	var website = getRowValue(selectItem[0],21).Trim();

	var param="id="+meetingID+"&name="+name+"&start_date="+start_date+"&end_date="+end_date+"&type="+type+
	"&district="+district+"&industry="+industry+"&charge="+charge+"&popular="+popular+"&level="+level
	+"&value="+value+"&organizer="+organizer+"&sponsor="+sponsor+"&name_en="+name_en+"&location="+location
	+"&abstract="+abstract+"&co_organizer="+co_organizer+"&contact="+contact+"&contact_phone="+contact_phone+"&contact_fax="+contact_fax
	+"&email="+email+"&website="+website;
	window.open("./updateMeeting.jsp?"+param, "修改会议信息");
}

function delMeeting(){
	if (confirmDel()){
		var selectItem = se.getSelectedItems();
		var meetingID = getRowValue(selectItem[0],0).Trim();
		var name = getRowValue(selectItem[0],1).Trim();
		if (meetingID == null){
			alert("请选择正确的会议信息！");
			return;
		}
		window.top.location="./delMeeting.do?id="+meetingID+"&name="+name;
	}else{
		return;
	}
}
</script>
<br />
</body>
</html:html>
